cmake_minimum_required(VERSION 2.8.3)
project(vision_ruler)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
add_definitions(-w)

#set(OpenCV_DIR "/home/agx/deps/opencv/build")

find_package(catkin REQUIRED COMPONENTS
	roscpp
	rospy
	std_msgs
	cv_bridge
	sensor_msgs
	nav_msgs
	message_generation
)
find_package(OpenCV REQUIRED COMPONENTS)
find_package(Eigen3 REQUIRED COMPONENTS)

add_subdirectory(./ThirdParty/GeographicLib/)

include_directories(
	${catkin_INCLUDE_DIRS}
	${OpenCV_INCLUDE_DIRS}
  ${EIGEN3_INCLUDE_DIR}
	${CMAKE_CURRENT_SOURCE_DIR}/include
  ./ThirdParty/GeographicLib/include/
)

link_directories(${OpenCV_LIBRARY_DIRS})

add_message_files(
  FILES
  points.msg
  GPS.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
)

catkin_package(
  CATKIN_DEPENDS roscpp rospy std_msgs sensor_msgs nav_msgs message_generation
  INCLUDE_DIRS include ThirdParty/GeographicLib/include
  LIBRARIES vision_ruler
)

# set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
# set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH})
# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH})


# flashai_commons
# include opencv/spdlog/freetype and other commons utils
set(CMAKE_PREFIX_PATH /usr/local/share/cmake)
find_package(flashai_commons REQUIRED)
include_directories(${flashai_commons_INCLUDE_DIRS})

add_library(
  vision_ruler 
  SHARED
  src/distortion_correction.cpp
  src/ProjectUtil.cpp
  src/VisionRuler.cpp
  src/GlobalUtil.cpp)
target_link_libraries(
  vision_ruler
  ${OpenCV_LIBRARIES}
  ${catkin_LIBRARIES}
  libGeographiccc
  inih)

# add_executable(domain src/domain.cpp)
# target_link_libraries(domain
#   ${OpenCV_LIBRARIES}
#   ${catkin_LIBRARIES}
#   ${flashai_commons_LIBRARIES}
#   vision_ruler
#   libGeographiccc
#   inih)
